/*
 * @Author: cgl
 * @Date: 2023-04-19 14:57:57
 * @LastEditors: cgl
 * @LastEditTime: 2023-08-30 15:53:41
 * @FilePath: \public-health-emergencies-fed:\radiation-hygiene-fe\src\api\testItem\detectionResult.js
 * @Description:
 *
 * Copyright (c) 2023 by cgl/微盛信息产业有限公司, All Rights Reserved.
 */
import request from '@/utils/request'

// 获取检测设备任务列表
export function detectionEquipmentList(data) {
  return request({
    url: '/task/detectionEquipment/list',
    method: 'post',
		data
  })
}
// 获取检测设备任务数量统计
export function detectionEquipmentCount() {
  return request({
    url: '/task/detectionEquipment/listStatistics',
    method: 'post',
  })
}
// 获取待认领检测设备任务列表
export function detectionEquipmentWaitClaimList(params) {
  return request({
    url: '/task/detectionEquipment/toBeClaimedTaskList',
    method: 'post',
		data: params
  })
}
// 认领检测设备任务
export function claimDetectionEquipmentTask(data) {
  return request({
    url: '/task/detectionEquipment/claimTask',
    method: 'post',
		data: data
  })
}
// 查看任务详情
export function detectionEquipmentDetail(id) {
  return request({
    url: '/task/detectionEquipment/' + id,
    method: 'get',
    // headers: {
		// 	isLoading: true,
		// }
  })
}
// 获取办理数据
export function getHandleData(data) {
  return request({
    url: '/task/detectionEquipment/getHandleData',
    method: 'post',
		data
  })
}
// 办理
export function handle(data) {
  return request({
    url: '/task/detectionEquipment/handle',
    method: 'post',
		data
  })
}
// 获取未在本次办理中的设备列表
export function getUnHandleEquipmentList(id) {
  return request({
    url: '/task/detectionEquipment/getUnHandleEquipmentList/' + id,
    method: 'get'
  })
}
// 删除设备
export function removeResult(resultId) {
  return request({
    url: '/task/detectionEquipment/removeResult/' + resultId,
    method: 'delete'
  })
}
// 添加设备
export function addResult(data) {
  return request({
    url: '/task/detectionEquipment/addResult',
    method: 'post',
		data,
    headers: {
			isLoading: true,
		}
  })
}
// 批量添加设备
export function addBatchResult(data) {
  return request({
    url: '/task/detectionEquipment/addBatchResult',
    method: 'post',
		data,
    headers: {
			isLoading: true,
		}
  })
}
// 添加设备详情
export function addEquipmentResult(data) {
  return request({
    url: `/task/detectionEquipment/addEquipmentResult`,
    method: 'post',
		data: data
  })
}

// 获取检测设备详细数据
export function getResultInfo(resultId) {
  return request({
    url: '/task/detectionEquipmentResult/getResultInfo/' + resultId,
    method: 'get'
  })
}
// 修改基本情况
export function updateBasicInfo(data) {
  return request({
    url: `/task/detectionEquipmentResult/updateBasicInfo`,
    method: "post",
    data,
		headers: {
			repeatSubmit: false,
      showErrMsg: true,
		}
  });
}
// 检测表单提交
export function submit(data) {
  return request({
    url: `/task/detectionEquipmentResult/submit`,
    method: "post",
    data
  });
}
// 生成录入报告
export function generateInputReport(resultId, isPdf, isMerge) {
  return request({
    url: `/task/detectionEquipmentResult/generateInputReport/${resultId}/${isPdf}/${isMerge}`,
    method: 'get',
    headers: {
			isLoading: true,
		}
  })
}
// 生成检测报告
export function generateTestReport(resultId, isPdf, isMerge) {
  return request({
    url: `/task/detectionEquipmentResult/generateTestReport/${resultId}/${isPdf}/${isMerge}`,
    method: 'get',
    headers: {
			isLoading: true,
		}
  })
}
// 修改检测类别
export function updateInspectionType(data) {
  return request({
    url: '/task/detectionEquipmentResult/updateInspectionType',
    method: 'post',
    data
  })
}
// 合并生成检测报告
export function mergeGenerateReport(taskId, isPdf) {
  return request({
    url: `/task/detectionEquipment/mergeGenerateReport/${taskId}/${isPdf}`,
    method: 'post',
    headers: {
			isLoading: true,
		}
  })
}
// 逐个生成检测报告
export function separatelyGenerateReport(taskId, isPdf) {
  return request({
    url: `/task/detectionEquipment/separatelyGenerateReport/${taskId}/${isPdf}`,
    method: 'post',
    headers: {
			isLoading: true,
		}
  })
}
// 记录录入时间
export function recordDetectionTime(resultId) {
  return request({
    url: '/task/detectionEquipmentResult/recordDetectionTime/' + resultId,
    method: 'get',
  })
}
// 上传合并报告docx文件
export function uploadMergeReportFile(params) {
  return request({
    url: `/task/detectionEquipment/uploadMergeReportFile`,
    method: 'post',
		params,
  })
}
// 上传现场记录docx文件
export function uploadInputReportFile(params) {
  return request({
    url: `/task/detectionEquipment/uploadInputReportFile`,
    method: 'post',
		params,
  })
}
// 上传检测报告docx文件
export function uploadTestReportFile(params) {
  return request({
    url: `/task/detectionEquipment/uploadTestReportFile`,
    method: 'post',
		params,
  })
}

// 根据isCbct查询CBCT
export function getCbctTypeCode(itemId) {
  return request({
    url: `/task/detectionEquipmentResult/getItem/${itemId}`,
    method: 'get',
  })
}

// 撤销设备任务
export function cancelTaskQuest(taskId) {
  return request({
    url: `/task/detectionEquipment/withdrawTask?taskId=${taskId}`,
    method: 'post'
  })
}

// 重新计算
export function resetComputed(taskDetectionEquipmentId) {
  return request({
    url: `/task/detectionEquipmentResult/recalculate/${taskDetectionEquipmentId}`,
    method: 'put'
  })
}

// 上传初稿文件
export function uploadChuGaoFile(data) {
  return request({
    url: `/task/detectionEquipmentResult/uploadDraft`,
    method: 'post',
		data: data,
  })
}
// 删除初稿文件
export function removeChuGaoFile(data) {
  return request({
    url: `/task/detectionEquipmentResult/removeDraft`,
    method: 'post',
		data: data,
  })
}

// 仅办理环境检测
export function onlyHandleEnv(id) {
  return request({
    url: `/task/detectionEquipment/onlyHandleEnv/${id}`,
    method: 'post',
  })
}

// 仅办理检测
export function onlyHandleDetection(id) {
  return request({
    url: `/task/detectionEquipment/onlyHandle/${id}`,
    method: 'post',
  })
}

// 导出印章使用记录
export function exportSealUseRecord(data) {
  return request({
    url: `/task/signUseRecord/export`,
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}

// 获取检测任务全部报告ossId(根据时间)
export function taskAllReportOssIdByDate(data) {
  return request({
    url: `/task/detectionEquipment/downloadIssuedReport`,
    method: 'post',
    data: data,
  })
}

// 获取检测任务全部报告ossId(根据任务id)
export function taskAllReportOssIdByTaskId(taskId) {
  return request({
    url: `/task/detectionEquipment/downloadFile/${taskId}`,
    method: 'post',
  })
}

// 大报告文件上传
export function uploadBigReportFile(data) {
  return request({
    url: `/task/detectionEquipment/uploadReportFile`,
    method: 'post',
    data: data,
  })
}
